<html>
<head><meta charset="utf-8"><title>recompute the register_plugins query · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/recompute.20the.20register_plugins.20query.html">recompute the register_plugins query</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="247651276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/recompute%20the%20register_plugins%20query/near/247651276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Gheorghe Anghelescu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/recompute.20the.20register_plugins.20query.html#247651276">(Jul 29 2021 at 22:52)</a>:</h4>
<p>while using <code>rustc_driver</code> I noticed that the compiler intentionally panics when the <code>register_plugins</code> query is generated after being stolen. should I open a bug report?</p>



<a name="247654356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/recompute%20the%20register_plugins%20query/near/247654356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/recompute.20the.20register_plugins.20query.html#247654356">(Jul 29 2021 at 23:27)</a>:</h4>
<p>afaik all Rust compiler panics are eligible bugs</p>



<a name="247654718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/recompute%20the%20register_plugins%20query/near/247654718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Gheorghe Anghelescu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/recompute.20the.20register_plugins.20query.html#247654718">(Jul 29 2021 at 23:32)</a>:</h4>
<p>I see. this one was triggered by calling the <code>std::panic</code> macro in the compiler code, so I was a wondering what is going on</p>



<a name="247657086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/recompute%20the%20register_plugins%20query/near/247657086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/recompute.20the.20register_plugins.20query.html#247657086">(Jul 30 2021 at 00:07)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281739">oliver</span> <a href="#narrow/stream/131828-t-compiler/topic/recompute.20the.20register_plugins.20query/near/247654356">said</a>:</p>
<blockquote>
<p>afaik all Rust compiler panics are eligible bugs</p>
</blockquote>
<p>well not if you poke into its internals</p>



<a name="247696917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/recompute%20the%20register_plugins%20query/near/247696917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/recompute.20the.20register_plugins.20query.html#247696917">(Jul 30 2021 at 11:43)</a>:</h4>
<p>You shouldn't steal any query if you want to continue compilation. There is no way to continue compilation if something necessary for compilation doesn't exist anymore. You should <code>.peek()</code> instead to borrow the query result.</p>



<a name="247704061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/recompute%20the%20register_plugins%20query/near/247704061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Gheorghe Anghelescu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/recompute.20the.20register_plugins.20query.html#247704061">(Jul 30 2021 at 12:59)</a>:</h4>
<p><span class="user-mention silent" data-user-id="133247">bjorn3</span> <a href="#narrow/stream/131828-t-compiler/topic/recompute.20the.20register_plugins.20query/near/247696917">said</a>:</p>
<blockquote>
<p>You shouldn't steal any query if you want to continue compilation. There is no way to continue compilation if something necessary for compilation doesn't exist anymore. You should <code>.peek()</code> instead to borrow the query result.</p>
</blockquote>
<p>It makes sense that in order to continue the compilation I should make sure that all queries that I steal are recomputed. The compiler panic I get is not because of missing query results.</p>



<a name="247704376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/recompute%20the%20register_plugins%20query/near/247704376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Gheorghe Anghelescu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/recompute.20the.20register_plugins.20query.html#247704376">(Jul 30 2021 at 13:01)</a>:</h4>
<p>I will open an issue with a repro. I'm waiting a bit to see if I can also send a fix at the same time.</p>



<a name="247705858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/recompute%20the%20register_plugins%20query/near/247705858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/recompute.20the.20register_plugins.20query.html#247705858">(Jul 30 2021 at 13:14)</a>:</h4>
<p>Some queries like macro expansion are not recomputable as they may be non-deterministic (proc-macros are not guaranteed to be deterministic. they should be from semantic perspective, but rustc can't depend on this). Others like codegen are way too expensive and a <code>TyCtxt</code> can only be created once per compilation session due to the fact that it affects the incremental compilation state.</p>



<a name="247705970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/recompute%20the%20register_plugins%20query/near/247705970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/recompute.20the.20register_plugins.20query.html#247705970">(Jul 30 2021 at 13:15)</a>:</h4>
<p>If you were to create a <code>TyCtxt</code> twice, you would get two dep graphs that conflict with each other.</p>



<a name="247722316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/recompute%20the%20register_plugins%20query/near/247722316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/recompute.20the.20register_plugins.20query.html#247722316">(Jul 30 2021 at 15:21)</a>:</h4>
<p>It does bug me that we use "queries" to mean both the dep-graph and the global Queries struct - maybe we could rename one or the other?</p>



<a name="247722412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/recompute%20the%20register_plugins%20query/near/247722412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/recompute.20the.20register_plugins.20query.html#247722412">(Jul 30 2021 at 15:22)</a>:</h4>
<p>(the global Queries struct gives me a headache in general)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>